package com.chen.lifepic.DataSource;

import com.chen.lifepic.utils.APPCommonDef.GirlType;
import com.loopj.android.http.AsyncHttpClient;
import com.loopj.android.http.JsonHttpResponseHandler;

public class RequestPicturesURLHelper {
	public static final String sex_girl_url = "http://tupian.baidu.com/channel/listjson?fr=channel&tag1=%E7%BE%8E%E5%A5%B3&tag2=%E6%80%A7%E6%84%9F&sorttype=0&pn=0&rn=30&ie=utf8&oe=utf-8&1373890413423";
	public static final String home_man_girl_url = "http://tupian.baidu.com/channel/listjson?fr=channel&tag1=%E7%BE%8E%E5%A5%B3&tag2=%E5%AE%85%E7%94%B7%E5%A5%B3%E7%A5%9E&sorttype=0&pn=0&rn=30&ie=utf8&oe=utf-8&1373890413423";
	public static final String cute_girl_url = "http://tupian.baidu.com/channel/listjson?fr=channel&tag1=%E7%BE%8E%E5%A5%B3&tag2=%E5%8F%AF%E7%88%B1&sorttype=0&pn=0&rn=30&ie=utf8&oe=utf-8&1373890413423";
	public static final String network_girl_url = "http://tupian.baidu.com/channel/listjson?fr=channel&tag1=%E7%BE%8E%E5%A5%B3&tag2=%E7%BD%91%E7%BB%9C%E7%BE%8E%E5%A5%B3&sorttype=0&pn=0&rn=30&ie=utf8&oe=utf-8&1373890413423";
	public static final String long_leg_girl_url = "http://tupian.baidu.com/channel/listjson?fr=channel&tag1=%E7%BE%8E%E5%A5%B3&tag2=%E9%95%BF%E8%85%BF&sorttype=0&pn=0&rn=30&ie=utf8&oe=utf-8&1373890413423";

	AsyncHttpClient _client = null;

	JsonHttpResponseHandler _handler;
	
	int _girlType = 0;

	public RequestPicturesURLHelper(JsonHttpResponseHandler handler, int girlType) {
		_girlType = girlType;
		_client = new AsyncHttpClient();
		_handler = handler;
	}

	public void request() {
		if (null == _client || null == _handler)
			return;

		// _client.post(url, _handler);
		_client.get(girlTypeToUrl(_girlType), null, _handler);
	}
	
	String girlTypeToUrl(int girlType){
		switch (girlType) {
		case GirlType.Girl_Cute_Girl:
			
			return cute_girl_url;

		case GirlType.Girl_Home_Men:
			return home_man_girl_url;
			
		case GirlType.Girl_Long_Leg:
			
			return long_leg_girl_url;
			
		case GirlType.Girl_Network:
			return network_girl_url;
			
		case GirlType.Girl_Sex_Girl:
			return sex_girl_url;
		default:
			return cute_girl_url;
		}
	}

	public void destroy() {
		_client = null;
		_handler = null;
	}
}
